package body outils is
    function listeInscrits(x : in communautes_strings.communaute'Class) return string is
   begin
      declare
         type access_string is access string;
         s : access_string;
      begin
         s := new string'("");
         if communautes_strings.nombre_inscrits(x) > 0 then
            for i in 1 ..communautes_strings.nombre_inscrits(x => x) loop
               s := new string'(s.all & natural'Image(i) & " " & communautes_strings.ieme_inscrit(x => x, i => i)& ASCII.LF);
            end loop;
         end if;
         return s.all;
      end;
   end listeInscrits;
     function listeInscritsNonBloques(x : in communautes_strings.communaute'Class; m :strings.individu) return string is
   begin
      declare
         type access_string is access string;
         s : access_string;
      begin
         s := new string'("");
         for i in 1.. communautes_strings.nombre_inscrits(x => x) loop
            if not communautes_strings.est_bloque(x, m, communautes_strings.ieme_inscrit(x => x, i => i)) then
               s := new string'(s.all & natural'Image(i) & " " & communautes_strings.ieme_inscrit(x => x, i => i)& ascii.lf);
            end if;
         end loop;
         return s.all;
      end;
   end listeInscritsNonBloques;

    function listeInscritsBloques(x : in communautes_strings.communaute'Class; m : strings.individu) return string is
   begin
      declare
         type access_string is access string;
         s : access_string;
      begin
         s := new string'("");
         for i in 1.. communautes_strings.nombre_inscrits(x => x) loop
            if communautes_strings.est_bloque(x, m, communautes_strings.ieme_inscrit(x => x, i => i)) then
               s := new string'(s.all & natural'Image(i) & " " & communautes_strings.ieme_inscrit(x => x, i => i) & ascii.lf);
            end if;
         end loop;
         return s.all;
      end;
   end listeInscritsBloques;

   function listeCerclesIndividu(x : in communautes_strings.communaute'Class; m : strings.individu) return string is
   begin
      declare
         type access_string is access string;
         s : access_string;
      begin
         s := new string'("");
         for i in 1 .. communautes_strings.nombre_cercles_de(x, m) loop
            s := new string'(s.all & natural'Image(i) & " " & communautes_strings.ieme_cercle(x, m, i) & ascii.lf);
         end loop;
         return s.all;
      end;
   end listeCerclesIndividu;

  function listeMembre(x : in communautes_strings.communaute'Class;m : strings.individu; c : strings.cercle) return string is
  begin
      declare
         type access_string is access string;
         s : access_string;
      begin
         s := new string'("");
         for i in 1 .. communautes_strings.nombre_inscrits(x) loop
            if (communautes_strings.est_membre_de(x, m, c, communautes_strings.ieme_inscrit(x, i)))then
               s := new string'(s.all & natural'Image(i) & " " & communautes_strings.ieme_inscrit(x, i)& ASCII.LF);
            end if;
         end loop;
         return s.all;
      end;
   end listeMembre;
     function listePostsIndividu(x : in  communautes_strings.communaute'Class; m : strings.Individu) return string is
   begin
      declare
         type access_string is access string;
         s : access_string;
      begin
         s := new string'("");
         for i in 1 .. communautes_strings.nombre_posts(x) loop
            if murs_strings.est_defini(communautes_strings.consulter(x, m), i) then
               s := new string'(s.all & natural'Image(i) & " " & murs_strings.ieme_post(communautes_strings.consulter(x, m), i) & ASCII.LF);
            end if;
         end loop;
         return s.all;
      end;
   end listePostsIndividu;

end outils;
